from core.support import set_cutscene
from core.item import Item
from core.action import Action

class Octopus_Ink(Item):
    def __init__(self):
        Item.__init__(self, "Octopus Ink")    # do basic initialization for every item
        self.has_ink = True
                
        # build list of actions
        self.add_action(ApplyInk)
    
    def get_description(self):
            return "Octopus Ink"

# define actions for this item

class ApplyInk(Action):
    def __init__(self):
        Action.__init__(self, "apply_ink")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Apply Octopus Ink"
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "post"
    
    # only works in basement. add cutscene
    def do_action(self,game,room,request):
        # does the player have a lit lamp?
        player = game.get_player()
        if 'paper' in player.inventory:
            set_cutscene("A mysterious letter start appear in the paper: SK666")
            self.item.has_ink = False
            return
                
        # if we get here, the lamp is not lit
        set_cutscene("You don't have the paper to add the ink")
        self.item.has_ink = False
        return